<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src = "jquery.js"></script>

</head>
<body>
<script type="text/javascript">
 $(document).ready(function(){
	
	 $("input[name=s]").bind('input', function(){
		 var s = $(this).val();
		 var conta = $(this).val().length;
		 
		 if(conta >= 1){
			 $.post('pesquisa.jsp',{s_post:s}, function(retorna){
				 $("#results").html(retorna);
			 });
		 }else{
			 $("#results").html('Pesquisar');
		 }
		 
	 });
	 
	 $("#pesquisa").submit(function(){
		 var s = $("input[name=s]").val();
		 
		 if(s == "" ){
			 $("#results").html('Pesquisar');
		 }else{
			 $.post('pesquisa.jsp',{s_post:s}, function(retorna){
				 $("#results").html(retorna);
			 });
		
		 }
		 return false;
		 
	 });
 });


</script>


<form  id = "pesquisa" action="" method="post" enctype="multipart/form-data">
<input type="text" name = "s" autocomplete= "off">
<input type="submit">
</form>
<hr>

<div id ="results">
</div>

</body>
</html>